{{template "header.html" .}}
<div class="container clear">
    <div id="article-list-header" class="clear">
        <h1 class="h1 left">文章</h1>
        <button class="btn save right" id="article-list-edit-btn">创建文章</button>
    </div>
    <div id="article-list-container" class="clear">
        <div id="article-list-category" class="left" data-index="{{.Category.id}}">
            <ul class="list">
                <li class="active"><a href="/admin/articles/">所有的</a></li>
                <li><a href="/admin/articles/category/none/" rel="-1">未分类</a></li>{{range .Categories}}
                <li><a href="/admin/articles/category/{{.slug}}/" rel="{{.id}}">{{.title}}</a></li>{{end}}
            </ul>
        </div>
        <div id="article-list">{{range .Articles}}
            <div class="article-list-item">
                <div class="top clear">
                    <a class="h3 left" href="/admin/articles/edit/{{.id}}/">{{.title}}</a>
                    <span class="status right">{{GetArticleStatusText .status}}</span>
                </div>
                <div class="btm">
                    <span class="time">09月22日 14:25</span>
                    <span class="view">评论 / 浏览 ( {{.comments}} / {{.views}} )</span>
                    <a class="goto" href="/article/{{.slug}}.html" target="_blank">{{.slug}}.html</a>
                </div>
            </div>{{end}}
        </div>
    </div>
    <div id="article-list-pager" class="pager">{{Raw .Pager}}</div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
       $('#article-list-edit-btn').on("click",function(){
          window.location.href = "/admin/articles/add/";
       });
        var $list = $("#article-list-category");
        var active = $list.data("index");
        if(active != ""){
            $list.find(".active").removeClass("active");
            $list.find("a[rel="+active+"]").parent().addClass("active");
        }
    });
</script>
</body>
</html>